<template>
  <a-modal
    :width="800"
    v-bind="modalOption"
    @ok="handleOk"
    @cancel="handleCancel"
  >
    <a-spin :spinning="confirmLoading">
      <a-form-model layout="horizontal" labelAlign="right" ref="ruleForm" :label-col="labelCol" :wrapper-col="wrapperCol" :model="form" :rules="validatorRules">
        <a-form-model-item label="任务类名" prop="jobClassName" >
          <a-input placeholder="请输入任务类名" v-model="form.jobClassName" />
        </a-form-model-item>
        <a-form-model-item label="cron表达式" prop="jobCron">
          <j-cron ref="innerVueCron" v-model="form.jobCron"></j-cron>
        </a-form-model-item>
        <a-form-model-item  label="参数">
          <a-textarea placeholder="请输入参数" v-model="form.jobParams" :rows="5" />
        </a-form-model-item>
        <a-form-model-item label="描述">
          <a-textarea placeholder="请输入描述" v-model="form.desc" :rows="3" />
        </a-form-model-item>
        <a-form-model-item label="状态">
          <a-radio-group v-model="form.status" buttonStyle="solid">
            <a-radio-button value="RUNNING">启动</a-radio-button>
            <a-radio-button value="PAUSE">暂停</a-radio-button>
          </a-radio-group>
        </a-form-model-item>
      </a-form-model>
    </a-spin>
  </a-modal>
</template>

<script>
import JCron from '@/components/zz/ZCron'
import ModalFormMixin from '@/mixins/ModalFormMixin'
export default {
  name: 'QuartzJobModal',
  mixins: [ModalFormMixin],
  components: {
    JCron
  },
  data() {
    return {
      buttonStyle: 'solid',
      cron: {
        label: '',
        value: ''
      },
      validatorRules: {
        jobClassName: [{ required: true, message: '请输入任务类名' }],
        jobCron: [{ required: true, message: '请输入任务表达式' }]
      },
      url: {
        add: '/quartz/add',
        edit: '/quartz/edit'
      }
    }
  },
  methods: {
    addAfter() {
      this.$set(this.form, 'status', 'RUNNING')
    }
  }
}
</script>

<style scoped>

</style>
